/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vn.ac.c0910g.assignment.Entity;

import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import vn.ac.c0910g.assignment.DAO.CategoryDAO;

/**
 *
 * @author BachLe
 */
@Stateless
public class ServicesFacade extends AbstractFacade<Services> {
    @PersistenceContext(unitName = "Alluring_Decors-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ServicesFacade() {
        super(Services.class);
    }

    public List<Services> findServicesByCategoryId(Integer id)
    {
        String eql = "SELECT s FROM Services s WHERE s.category.categoryID =: categoryID";
        return em.createQuery(eql).setParameter("categoryID", id).getResultList();
    }
}
